/* $Id: AndContext.h 27 2011-09-16 13:28:08Z skagget77 $ */

/*!
 * \file
 * \author  Johan Andersson <skagget77@gmail.com>
 * \date    Mon Feb 15 20:59 2010
 * \ingroup IoCpp
 * \brief   IoCpp Scanner EDSL.
 */

#if !defined(IOCPP_ANDCONTEXT_H)
#define IOCPP_ANDCONTEXT_H

#include "AndWithoutExecutableContext.h"
#include "ScanContext.h"

namespace IoCpp
{
   /*!
    * \author  Johan Andersson <skagget77@gmail.com>
    * \date    Mon Feb 15 20:59 2010
    * \ingroup IoCpp
    * \sa      Scanner for information on how to use IoCpp Scanner EDSL.
    * \brief   The AndContext class, part of IoCpp Scanner EDSL.
    *
    * \details This class should only be used indirectly through the Scanner
    *          class which is the entry point to the Scanner EDSL.
    */
   class AndContext
   {
   public :
      /*!
       * Creates a new instance of the AndContext class.
       *
       * \param context the ScanContext holding the EDSL state.
       */
      AndContext( ScanContextPtr context )
         : mContext(context) {
      }

      /*!
       * Selects an additional library to scan.
       *
       * \param  library the library to scan.
       * \return This AndContext.
       */
      AndContext AndLibrary( const FileCollection::value_type& library ) const
      {
         mContext->AddLibrary(library, false);
         return *this;
      }

      /*!
       * Selects an additional optional library to scan.
       *
       * \param  library the optional library to scan.
       * \return This AndContext.
       */
      AndContext AndOptionalLibrary( const FileCollection::value_type& library ) const
      {
         mContext->AddLibrary(library, true);
         return *this;
      }

      /*!
       * Selects an additional path to scan.
       *
       * \param  path the path to scan.
       * \return This AndContext.
       */
      AndContext AndPath( const PathCollection::value_type& path ) const 
      {
         mContext->AddPath(path, false);
         return *this;
      }

      /*!
       * Selects an additional optional path to scan.
       *
       * \param  path the optional path to scan.
       * \return This AndContext.
       */
      AndContext AndOptionalPath( const PathCollection::value_type& path ) const 
      {
         mContext->AddPath(path, true);
         return *this;
      }

      /*!
       * Selects to scan the current executable in addition to libraries and
       * paths.
       *
       * \return An AndWithoutExecutableContext.
       */
      AndWithoutExecutableContext AndExecutable() const 
      {
         mContext->AddExecutable();
         return AndWithoutExecutableContext(mContext);
      }

   private :
      ScanContextPtr mContext;
   };
}

#endif   // IOCPP_ANDCONTEXT_H
